package com.ruoyi.system.domain;

import java.util.Date;
import javax.validation.constraints.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 新闻资讯对象 credit_news
 * 
 * @author ruoyi
 * @date 2025-01-28
 */
public class CreditNews extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 新闻ID */
    private Long newsId;

    /** 新闻标题 */
    @Excel(name = "新闻标题")
    private String newsTitle;

    /** 新闻内容 */
    @Excel(name = "新闻内容")
    private String newsContent;

    /** 新闻摘要 */
    @Excel(name = "新闻摘要")
    private String newsSummary;

    /** 新闻配图 */
    @Excel(name = "新闻配图")
    private String newsImage;

    /** 新闻分类 */
    @Excel(name = "新闻分类")
    private String newsCategory;

    /** 作者 */
    @Excel(name = "作者")
    private String author;

    /** 浏览次数 */
    @Excel(name = "浏览次数")
    private Integer viewCount;

    /** 是否发布（0未发布 1已发布） */
    @Excel(name = "是否发布", readConverterExp = "0=未发布,1=已发布")
    private Integer publishStatus;

    /** 是否置顶（0不置顶 1置顶） */
    @Excel(name = "是否置顶", readConverterExp = "0=不置顶,1=置顶")
    private Integer isTop;

    /** 排序顺序 */
    @Excel(name = "排序顺序")
    private Integer sortOrder;

    /** 发布时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date publishTime;

    // 前端兼容字段
    public String getTitle() {
        return this.newsTitle;
    }

    public void setTitle(String title) {
        this.newsTitle = title;
    }

    public String getContent() {
        return this.newsContent;
    }

    public void setContent(String content) {
        this.newsContent = content;
    }

    public String getSummary() {
        return this.newsSummary;
    }

    public void setSummary(String summary) {
        this.newsSummary = summary;
    }

    public String getCategory() {
        return this.newsCategory;
    }

    public void setCategory(String category) {
        this.newsCategory = category;
    }

    public Integer getReadCount() {
        return this.viewCount;
    }

    public void setReadCount(Integer readCount) {
        this.viewCount = readCount;
    }

    public Integer getPublishStatus() {
        return this.publishStatus;
    }

    public void setPublishStatus(Integer publishStatus) {
        this.publishStatus = publishStatus;
    }

    // 兼容方法，用于支持旧的isPublished字段
    public Integer getIsPublished() {
        return this.publishStatus;
    }

    public void setIsPublished(Integer isPublished) {
        this.publishStatus = isPublished;
    }

    public void setNewsId(Long newsId) 
    {
        this.newsId = newsId;
    }

    public Long getNewsId() 
    {
        return newsId;
    }

    public void setNewsTitle(String newsTitle) 
    {
        this.newsTitle = newsTitle;
    }

    @NotBlank(message = "新闻标题不能为空")
    @Size(max = 200, message = "新闻标题长度不能超过200个字符")
    public String getNewsTitle() 
    {
        return newsTitle;
    }

    public void setNewsContent(String newsContent) 
    {
        this.newsContent = newsContent;
    }

    public String getNewsContent() 
    {
        return newsContent;
    }

    public void setNewsSummary(String newsSummary) 
    {
        this.newsSummary = newsSummary;
    }

    @Size(max = 500, message = "新闻摘要长度不能超过500个字符")
    public String getNewsSummary() 
    {
        return newsSummary;
    }

    public void setNewsImage(String newsImage) 
    {
        this.newsImage = newsImage;
    }

    @Size(max = 500, message = "新闻配图长度不能超过500个字符")
    public String getNewsImage() 
    {
        return newsImage;
    }

    public void setNewsCategory(String newsCategory) 
    {
        this.newsCategory = newsCategory;
    }

    @Size(max = 50, message = "新闻分类长度不能超过50个字符")
    public String getNewsCategory() 
    {
        return newsCategory;
    }

    public void setAuthor(String author) 
    {
        this.author = author;
    }

    @Size(max = 50, message = "作者长度不能超过50个字符")
    public String getAuthor() 
    {
        return author;
    }

    public void setViewCount(Integer viewCount) 
    {
        this.viewCount = viewCount;
    }

    public Integer getViewCount() 
    {
        return viewCount;
    }

    public void setIsTop(Integer isTop) 
    {
        this.isTop = isTop;
    }

    public Integer getIsTop() 
    {
        return isTop;
    }

    public void setSortOrder(Integer sortOrder) 
    {
        this.sortOrder = sortOrder;
    }

    public Integer getSortOrder() 
    {
        return sortOrder;
    }

    public void setPublishTime(Date publishTime) 
    {
        this.publishTime = publishTime;
    }

    public Date getPublishTime() 
    {
        return publishTime;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("newsId", getNewsId())
            .append("newsTitle", getNewsTitle())
            .append("newsContent", getNewsContent())
            .append("newsSummary", getNewsSummary())
            .append("newsImage", getNewsImage())
            .append("newsCategory", getNewsCategory())
            .append("author", getAuthor())
            .append("viewCount", getViewCount())
            .append("publishStatus", getPublishStatus())
            .append("isTop", getIsTop())
            .append("sortOrder", getSortOrder())
            .append("publishTime", getPublishTime())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .toString();
    }
} 